#pragma once

#ifdef ALGORITHM_EXPORTS
#define ALGORITHM_API __declspec(dllexport)
#else
#define ALGORITHM_API __declspec(dllimport)
#endif

struct IAlgorithm;

typedef bool (*func_update_progress)( int max, int cur, void *userdata );
typedef bool (*func_update_result)( const char* data, size_t size, void *userdata );
typedef void (*func_sleep)();
typedef IAlgorithm* (*func_create)( const wchar_t* name );
typedef void (*func_destroy)( IAlgorithm* algrithm );

struct IAlgorithm
{
	virtual
	const wchar_t*
	get_name()const = 0;

	virtual
	bool
	initialize( void* data, size_t size ) = 0;

	virtual
	bool 
	set_algrithm_data( void* lpData, size_t size ) = 0;

	virtual
	bool
	start( void *userdata ) = 0;

	virtual
	void
	stop() = 0;

	func_sleep				run_sleep;
	func_update_progress	update_progress;
	func_update_result		update_result;
};

struct module
{
	const wchar_t*	module_name;
	struct _algorithm
	{
		const wchar_t* name;
		struct _algorithm* next;
	};
	_algorithm*		head;
	func_create		create_algorithm;
	func_destroy	destroy_algorithm;
};
